﻿using Paas.Core.Const.Enums.Approvals;
using Paas.Core.Sys.Entities;
using Basefr.Attributes;
using Basefr.Core.Consts.Enums;
using Basefr.Core.Entities;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

namespace Paas.Core.Approvals.Entities
{
    /// <summary>
    /// 审批流程
    /// </summary>
    [MainTable(nameof(Approve))]
    public class Approve : EntityBase
    {
        /// <summary>
        /// 模板
        /// </summary>
        public int TemplateId { get; set; }
        [ForeignKey(nameof(TemplateId))]
        public virtual ApproveTemplate Template { get; set; }

        /// <summary>
        /// 类型
        /// </summary>
        public EnumApproveType Type { get; set; }

        /// <summary>
        /// 对象ID
        /// </summary>
        public int ObjectId { get; set; }

        /// <summary>
        /// 申请人
        /// </summary>
        public long ApplicantId { get; set; }
        [ForeignKey(nameof(ApplicantId))]
        public virtual User Applicant { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public EnumApproveState State { get; set; }

        /// <summary>
        /// 审批步骤
        /// </summary>
        public virtual List<ApproveStep> Steps { get; set; }
    }
}

